package com.iris.app.deadline;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.iris.app.deadline.vo.FileInfo;

public class DS6VIDEO extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * The doGet method of the servlet. <br>
	 * 
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request
	 *            the request send by the client to the server
	 * @param response
	 *            the response send by the server to the client
	 * @throws ServletException
	 *             if an error occurred
	 * @throws IOException
	 *             if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String[] fileName = { "试乘试驾.mp4", "1竞品Q3.mp4", "2竞品途观.mp4",
				"3竞品翼虎.mp4", "4竞品CR-V.mp4", "1-市场环境.mp4", "2-产品推介.mp4", "3-产品优势.mp4",
				"4-目标客户群体.mp4", "5-客户关注重点.mp4", "DS之翼.mp4", "八连冠THP高效发动机.mp4",
				"多路况适应系统.mp4", "高强度车身结构.mp4", "精湛奢华的座舱.mp4", "全景天窗.mp4",
				"生态健康设计.mp4", "尾部设计.mp4", "照明系统.mp4", "智能互联.mp4" };
		String[] downPath = { "shijia.mp4", "1jingpinQ3.mp4",
				"2jingpintuguan.mp4", "3jingpinyihu.mp4", "4jingpincrv.mp4",
				"ds6shichangvideo1.mp4", "ds6shichangvideo2.mp4",
				"ds6shichangvideo3.mp4", "ds6shichangvideo4.mp4",
				"ds6shichangvideo5.mp4", "dszhiyi.mp4", "dsfadongj.mp4",
				"dslukuangxitong.mp4", "dscheshenjiegou.mp4", "dszuochang.mp4",
				"dstianchuang.mp4", "dsjiankang.mp4", "dsweibu.mp4",
				"dszhaoming.mp4", "dshulian.mp4" };
		response.setContentType("text/html");
		response.setCharacterEncoding("utf-8");

		PrintWriter out = response.getWriter();

		Gson gson = new Gson();

		List<FileInfo> list = new ArrayList<FileInfo>();

		for (int i = 0; i < fileName.length; i++) {
			FileInfo first = new FileInfo(fileName[i], "1", downPath[i]);
			list.add(first);
		}
		String json = gson.toJson(list);
		out.write(json);

	}

	/**
	 * The doPost method of the servlet. <br>
	 * 
	 * This method is called when a form has its tag value method equals to
	 * post.
	 * 
	 * @param request
	 *            the request send by the client to the server
	 * @param response
	 *            the response send by the server to the client
	 * @throws ServletException
	 *             if an error occurred
	 * @throws IOException
	 *             if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doGet(request, response);

	}

}
